# -*- coding: utf-8 -*-
# @Time    : 2021/9/1 13:25
# @Author  : BrandonGT
# @FileName: 14_PyQt5_QFormLayout.py

import sys
from PyQt5.QtWidgets import *


class Window(QWidget):
    def __init__(self):
        super().__init__()  # 初始化继承的父类内部的__init__
        self.setWindowTitle("QFormLayout的学习")
        self.resize(300, 300)
        self.setup_ui()

    def setup_ui(self):
        la1 = QLabel("a")
        la2 = QLabel("b")

        te1 = QLineEdit()
        te2 = QSpinBox()

        layout = QFormLayout()

        # layout.addWidget(la1)
        # layout.addWidget(te1)
        layout.addRow(la1, te1)
        layout.addRow(la2, te2)


        self.setLayout(layout)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Window()
    window.show()
    sys.exit(app.exec_())